<template >
  <div>
    <el-form
      :model="ruleForm"
      ref="ruleForm"
      label-width="100px"
      class="demo-ruleForm"
    >
      <el-form-item label="角色名称">
        <el-input v-model="ruleForm.roleName"></el-input>
      </el-form-item>
      <el-form-item label="角色介绍">
        <el-input v-model="ruleForm.roleDescription"></el-input>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { UpeRole } from "@/api/admin";
import { RoleById } from "@/api/admin";
export default {
  props: {
    roleId: Number,
  },
  data() {
    return {
      ruleForm: {
        roleName: "",
        roleDescription: "",
      },
    };
  },
  methods: {
    postRole() {
      UpeRole(this.ruleForm).then((res) => {
        if (res.data) {
          this.$message.success("修改成功");
        }
      });
    },
    getbyid() {
      RoleById(this.roleId).then((res) => {
        this.ruleForm = res.data;
      });
    },
  },
  created() {
    this.getbyid();
  },
};
</script>
<style >
</style>